<template>
	<view class="page">
		<u-cell-group :border="false">
			<u-cell 
			 v-for="(item,index) in itemList"
			 :key="index"
			 :url="item.path"
			 :title="item.name"
			 :clickable="true"
			 :titleStyle="{
				 paddingTop: '10rpx',
				 paddingBottom: '10rpx'
			 }"></u-cell>
		</u-cell-group>
		<u-gap height="80" ></u-gap>
		<u-button text="退出登录" color="#FC2422" @tap="logout"></u-button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				itemList: [
					{
						name: '个人资料',
						path: '/pages/aPackage/userInfo/userInfo'
					},
					{
						name: '修改登录密码', 
						path: '/pages/aPackage/settingPassword/settingPassword'
					},
					{
						name: '隐私政策',
						path: '/pages/aPackage/privacy/privacy'
					}
				]
			};
		},
		methods: {
			// 退出登录
			logout() {
				uni.showModal({
					title: '提示',
					content: '确定要退出吗?',
					success: (e) => {
						if(e.confirm) {
							this.$store.commit('SET_LOGIN',{
								sess_id: null,
								user_id: null
							})
							uni.showToast({
								title: '退出成功!'
							})
							setTimeout(() => {
								this.$store.commit('SET_TABBAR_INDEX',0)
								uni.reLaunch({
									url: '/pages/index/index'
								})
							},300)
						}
					}
				})
				
			}
		}
	}
</script>

<style lang="scss" scoped>

</style>
